package com.meiqiongproperty.yiguanjia.db.table;

/**
 * @version V1.0
 * @packge com.meiqiongproperty.yiguanjia.db.table
 * @User ChenJing
 * @Date 2017/6/18
 */

public interface ShoppingCarTable {
    public static final String TABLE_NAME = "shoppingcar_info";
    public static final String ID="_Id";
    public static final String PRODUCT_ID="product_id";
    public static final String PRODUCT_TITLE="product_title";
    public static final String PRODUCT_OPRICE="product_oprice";
    public static final String PRODUCT_PRICE="product_price";
    public static final String PRODUCT_IMAGE="product_image";
    public static final String PRODUCT_COUNT="product_count";


    // 字段的索引号
    public static final int INDEX_ID = 0;
    public static final int INDEX_PRODUCT_ID=1;
    public static final int INDEX_PRODUCT_TITLE = 2;
    public static final int INDEX_PRODUCT_OPRICE = 3;
    public static final int INDEX_PRODUCT_PRICE = 4;
    public static final int INDEX_PRODUCT_IMAGE= 5;
    public static final int INDEX_PRODUCT_COUNT=6;


    /**
     * SQL,删除表
     */
    public static final String SQL_TABLE_DROP = String.format(
            "DROP TABLE IF EXISTS %s;", TABLE_NAME);
    /**
     * SQL,创建表
     */
    public static final String SQL_TABLE_CREATE = new StringBuilder()
            .append("CREATE TABLE IF NOT EXISTS ").append(TABLE_NAME)
            .append("(").append(ID).append(" INTEGER PRIMARY KEY,")
            .append(PRODUCT_ID).append(" TEXT,")
            .append(PRODUCT_TITLE).append(" TEXT,")
            .append(PRODUCT_OPRICE).append(" TEXT,")
            .append(PRODUCT_PRICE).append(" TEXT,")
            .append(PRODUCT_IMAGE).append(" TEXT,")
            .append(PRODUCT_COUNT).append(" TEXT").append(");").toString();
}
